<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="root">
    <input v-model="firstName" type="text" placeholder="请输入姓">+
    <input v-model="lastName" type="text" placeholder="请输入名">
    <p>全名：{{firstName+lastName}}</p>
    <p>全名：{{fullName}}</p>
<!--    <button @click="count++">{{count}}</button>-->
</div>
</body>
<script>
	new Vue({
		el: "#root",
        data:{
			firstName:"",
            lastName:"",
            count:100,
            fullName:""
        },
        computed:{
			// fullName(){
			// 	return this.firstName+this.lastName;
            // }
        },
        watch:{
			firstName(newValue){
				this.fullName = newValue+this.lastName;
            },
            lastName(newValue){
				this.fullName = this.firstName+newValue;
            }
        }
	})
</script>
</html>